home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / CZBindMaker / Version.cs < prev    next >
Text File  |  2003-11-29  |  11KB  |  292 lines

  1. /* 
  2.  * CZ Bind Maker
  3.  * 
  4.  * By: Steven Whitley (aka [CZ] Qw4z0)
  5.  * 
  6.  * CZ Bind Maker is a key Bind utility for Counter-Strike 1.6
  7.  * and is distributed under the GNU Public License.
  8.  * 
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  * 
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details. 
  18.  * 
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  * 
  23.  * If you need further support for this program you may visit
  24.  * http://www.bindmaker.org/ and post in the forums for help.
  25.  * 
  26.  *  
  27.  * Any Changes or modifications of this source may be submitted for inclusion
  28.  * in the official release of CZ Bind Maker to Steve Whitley at support@bindmaker.org.
  29.  *  
  30.  * Be sure to comment your code as follows:
  31.  * 
  32.  * // [ AUTHOR ] [ DATE ] 
  33.  * // [ DESCRIPTION OF THE CHANGE OR ADDITION ]
  34.  * 
  35.  * */
  36.  
  37. /* ###############################################
  38.  * #          Sand Bar Library License           #
  39.  * ###############################################
  40.  * 
  41.  * This release of SandBar is available at no charge for you to use in your freeware products 
  42.  * royalty-free. This license does not allow distribution of SandBar with software that is
  43.  * sold or generates income in any way. Use of this release is subject to my name being
  44.  * displayed as a credit in the About dialog in your application. If this is unacceptable you
  45.  * will need to purchase the commercial license.
  46.  * 
  47.  * When distributing this product with software where the source code is available (under
  48.  * GPL or other similar licenses) you are required to distribute this license file with the
  49.  * binary. This is to ensure other developers understand fully the terms of this release.
  50.  * 
  51.  * By using, downloading or posessing this product you agree not to attempt to decompile or
  52.  * reverse engineer it in any way. Enjoy!
  53.  * 
  54.  * Tim Dawson
  55.  * http://www.divil.co.uk/net/
  56.  * 
  57.  * */
  58.  
  59. using System;
  60. using System.Net;
  61. using System.Drawing;
  62. using System.Threading;
  63. using System.Collections;
  64. using System.Diagnostics;
  65. using System.Windows.Forms;
  66. using System.ComponentModel;
  67.  
  68. namespace CZBindMaker
  69. {
  70.     /// <summary>
  71.     /// Summary description for Version.
  72.     /// </summary>
  73.     public class Version : System.Windows.Forms.Form
  74.     {
  75.         private System.Windows.Forms.Label label1;
  76.         private System.Windows.Forms.Label label2;
  77.         private System.Windows.Forms.Label currentVersion;
  78.         private System.Windows.Forms.Label label3;
  79.         private System.Windows.Forms.Label newestVersion;
  80.         private System.Windows.Forms.Button updateMe;
  81.         private System.Windows.Forms.Button ignore;
  82.         private string m_link;
  83.         private double m_curVersion;
  84.         private double m_newVersion;
  85.         private System.Windows.Forms.ToolTip toolTip1;
  86.         private System.Windows.Forms.Button Go;
  87.         private System.Windows.Forms.Label tip;
  88.         private System.ComponentModel.IContainer components;
  89.  
  90.         public Version(double curVersion, double newVersion, string link)
  91.         {
  92.             InitializeComponent();
  93.             this.m_link = link;
  94.             this.currentVersion.Text = (this.m_curVersion = curVersion).ToString();
  95.             this.newestVersion.Text = (this.m_newVersion = newVersion).ToString();
  96.         }
  97.  
  98.         /// <summary>
  99.         /// Clean up any resources being used.
  100.         /// </summary>
  101.         protected override void Dispose( bool disposing )
  102.         {
  103.             if( disposing )
  104.             {
  105.                 if(components != null)
  106.                 {
  107.                     components.Dispose();
  108.                 }
  109.             }
  110.             base.Dispose( disposing );
  111.         }
  112.  
  113.         #region Windows Form Designer generated code
  114.         /// <summary>
  115.         /// Required method for Designer support - do not modify
  116.         /// the contents of this method with the code editor.
  117.         /// </summary>
  118.         private void InitializeComponent()
  119.         {
  120.             this.components = new System.ComponentModel.Container();
  121.             System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Version));
  122.             this.label1 = new System.Windows.Forms.Label();
  123.             this.label2 = new System.Windows.Forms.Label();
  124.             this.currentVersion = new System.Windows.Forms.Label();
  125.             this.label3 = new System.Windows.Forms.Label();
  126.             this.newestVersion = new System.Windows.Forms.Label();
  127.             this.updateMe = new System.Windows.Forms.Button();
  128.             this.ignore = new System.Windows.Forms.Button();
  129.             this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
  130.             this.Go = new System.Windows.Forms.Button();
  131.             this.tip = new System.Windows.Forms.Label();
  132.             this.SuspendLayout();
  133.             // 
  134.             // label1
  135.             // 
  136.             this.label1.Location = new System.Drawing.Point(8, 8);
  137.             this.label1.Name = "label1";
  138.             this.label1.Size = new System.Drawing.Size(280, 16);
  139.             this.label1.TabIndex = 0;
  140.             this.label1.Text = "Your version of CZ Bind Maker is outdated!";
  141.             this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
  142.             // 
  143.             // label2
  144.             // 
  145.             this.label2.Location = new System.Drawing.Point(8, 40);
  146.             this.label2.Name = "label2";
  147.             this.label2.Size = new System.Drawing.Size(80, 16);
  148.             this.label2.TabIndex = 1;
  149.             this.label2.Text = "Your Version:";
  150.             this.toolTip1.SetToolTip(this.label2, "Your current version of CZ Bind Maker");
  151.             // 
  152.             // currentVersion
  153.             // 
  154.             this.currentVersion.Location = new System.Drawing.Point(80, 40);
  155.             this.currentVersion.Name = "currentVersion";
  156.             this.currentVersion.Size = new System.Drawing.Size(200, 16);
  157.             this.currentVersion.TabIndex = 2;
  158.             // 
  159.             // label3
  160.             // 
  161.             this.label3.Location = new System.Drawing.Point(8, 64);
  162.             this.label3.Name = "label3";
  163.             this.label3.Size = new System.Drawing.Size(80, 16);
  164.             this.label3.TabIndex = 3;
  165.             this.label3.Text = "Latest Version:";
  166.             this.toolTip1.SetToolTip(this.label3, "The Version of the latest version of CZ Bind Maker");
  167.             // 
  168.             // newestVersion
  169.             // 
  170.             this.newestVersion.Location = new System.Drawing.Point(80, 64);
  171.             this.newestVersion.Name = "newestVersion";
  172.             this.newestVersion.Size = new System.Drawing.Size(200, 16);
  173.             this.newestVersion.TabIndex = 4;
  174.             // 
  175.             // updateMe
  176.             // 
  177.             this.updateMe.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  178.             this.updateMe.Location = new System.Drawing.Point(205, 112);
  179.             this.updateMe.Name = "updateMe";
  180.             this.updateMe.Size = new System.Drawing.Size(74, 23);
  181.             this.updateMe.TabIndex = 5;
  182.             this.updateMe.Text = "Update Me!";
  183.             this.toolTip1.SetToolTip(this.updateMe, "Update CZ Bind Maker Now!\nThis could take some time over slower connections...");
  184.             this.updateMe.Click += new System.EventHandler(this.updateMe_Click);
  185.             this.updateMe.MouseEnter += new System.EventHandler(this.updateMe_MouseEnter);
  186.             this.updateMe.MouseLeave += new System.EventHandler(this.updateMe_MouseLeave);
  187.             // 
  188.             // ignore
  189.             // 
  190.             this.ignore.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  191.             this.ignore.Location = new System.Drawing.Point(13, 112);
  192.             this.ignore.Name = "ignore";
  193.             this.ignore.Size = new System.Drawing.Size(74, 23);
  194.             this.ignore.TabIndex = 6;
  195.             this.ignore.Text = "Ignore This";
  196.             this.toolTip1.SetToolTip(this.ignore, "Click this to ignore this update (not recomended)");
  197.             this.ignore.Click += new System.EventHandler(this.ignore_Click);
  198.             this.ignore.MouseEnter += new System.EventHandler(this.ignore_MouseEnter);
  199.             this.ignore.MouseLeave += new System.EventHandler(this.updateMe_MouseLeave);
  200.             // 
  201.             // Go
  202.             // 
  203.             this.Go.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  204.             this.Go.Location = new System.Drawing.Point(102, 112);
  205.             this.Go.Name = "Go";
  206.             this.Go.Size = new System.Drawing.Size(88, 24);
  207.             this.Go.TabIndex = 7;
  208.             this.Go.Text = "Get it Yourself";
  209.             this.toolTip1.SetToolTip(this.Go, "Download the latest version from the website\n\nYou will be prompted to update ever" +
  210.                 "ytime you start the appliction until you update");
  211.             this.Go.Click += new System.EventHandler(this.Go_Click);
  212.             this.Go.MouseEnter += new System.EventHandler(this.Go_MouseEnter);
  213.             this.Go.MouseLeave += new System.EventHandler(this.updateMe_MouseLeave);
  214.             // 
  215.             // tip
  216.             // 
  217.             this.tip.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
  218.             this.tip.Location = new System.Drawing.Point(8, 88);
  219.             this.tip.Name = "tip";
  220.             this.tip.Size = new System.Drawing.Size(272, 16);
  221.             this.tip.TabIndex = 8;
  222.             // 
  223.             // Version
  224.             // 
  225.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  226.             this.ClientSize = new System.Drawing.Size(292, 146);
  227.             this.Controls.Add(this.tip);
  228.             this.Controls.Add(this.Go);
  229.             this.Controls.Add(this.newestVersion);
  230.             this.Controls.Add(this.ignore);
  231.             this.Controls.Add(this.updateMe);
  232.             this.Controls.Add(this.currentVersion);
  233.             this.Controls.Add(this.label3);
  234.             this.Controls.Add(this.label2);
  235.             this.Controls.Add(this.label1);
  236.             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
  237.             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  238.             this.Name = "Version";
  239.             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  240.             this.Text = "CZ Bind Maker Version Control";
  241.             this.ResumeLayout(false);
  242.  
  243.         }
  244.         #endregion
  245.  
  246.         private void updateMe_Click(object sender, System.EventArgs e)
  247.         {
  248.             WebClient w = new WebClient();
  249.             try
  250.             {
  251.                 w.DownloadFile(this.m_link,"upgrade.exe");
  252.                 System.Diagnostics.Process.Start("upgrade.exe");
  253.             }
  254.             catch(Exception ex)
  255.             {
  256.                 ex.ToString();
  257.             }
  258.         }
  259.  
  260.         private void ignore_Click(object sender, System.EventArgs e)
  261.         {
  262.             this.DialogResult = DialogResult.Abort;
  263.         }
  264.  
  265.         private void updateMe_MouseEnter(object sender, System.EventArgs e)
  266.         {
  267.             this.tip.Text = "This could take some time over slower connections";
  268.         }
  269.  
  270.         private void updateMe_MouseLeave(object sender, System.EventArgs e)
  271.         {
  272.             this.tip.Text = "";
  273.         }
  274.  
  275.         private void Go_MouseEnter(object sender, System.EventArgs e)
  276.         {
  277.             this.tip.Text = "Download the update from the website";
  278.         }
  279.  
  280.         private void ignore_MouseEnter(object sender, System.EventArgs e)
  281.         {
  282.             this.tip.Text = "Ignore and continue";
  283.         }
  284.  
  285.         private void Go_Click(object sender, System.EventArgs e)
  286.         {
  287.             Process.Start("https://sourceforge.net/project/showfiles.php?group_id=87863");
  288.             Application.Exit();
  289.         }
  290.     }
  291. }
  292.